-
-
Notifications
You must be signed in to change notification settings - Fork 101
Add support for stop(cause:)
.
#388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1aee925
to
53670d1
Compare
I found an issue, |
I test w/ a
Seems there is too much nesting. |
53670d1
to
dcf42b9
Compare
@macournoyer I was able to understand the cause of the output you are seeing. fiber = Fiber.new do
while true
begin
Fiber.yield
rescue Exception => error
puts "error: #{error.inspect}", "error.cause: #{error.cause.inspect}"
end
end
end
fiber.resume
# Example of raising an exception with a cause:
fiber.raise StandardError.new("boom"), cause: StandardError.new("cause") On 3.4, the cause is not correctly attributed to the error and instead ends up being a keyword argument.
On ruby-head, the cause is correctly attributed to the error (including this PR):
Deeply nested cause |
Another before/after example: require_relative "lib/async"
Async do
sleep
ensure
Console.error(self, "Task exiting", $!)
end 3.4.4 on main (without this PR)
3.4.4 + this PR
HEAD + this PR
HEAD (without this PR)Interestingly enough,
|
dcf42b9
to
e208922
Compare
Okay, the changes to CRuby were merged. We just need to make this work as best we can across different Ruby versions. |
0f89936
to
195cf8c
Compare
… for older Ruby versions.
195cf8c
to
33811a5
Compare
Add
cause:
toAsync::Task#stop(cause:)
so that extra information about the reason for stopping can be provided. It must be an exception suitable forraise Async::Stop, cause: cause
.Fixes #387.
Types of Changes
Contribution